<template>
    <div id="dialog-container">
        <el-dialog v-dialogDrag 
            :title="dialogTitle" append-to-body
            :visible.sync="dialogVisible" @close="$emit('update:show', false)" :before-close="handleClose" :show="show"
            :close-on-click-modal="false" width="700px">
            <el-form :model="form" :inline="true" size="small" label-width="100px">
                <el-row>
                    <el-col :span="12">
                        <el-form-item label="检测类型：">
                            <el-input size="" v-model="form.sort" disabled></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="生产厂家：">
                            <el-input size="" v-model="form.sort" disabled></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="委托人：">
                            <el-input size="" v-model="form.sort" disabled></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="委托单位：">
                            <el-input size="" v-model="form.sort"></el-input>
                        </el-form-item>
                    </el-col>
                    <el-col :span="12">
                        <el-form-item label="委托日期：">
                            <el-input size="" v-model="form.sort" disabled></el-input>
                        </el-form-item>
                    </el-col>
                   
                    <el-col :span="8" :offset="1">
                        <el-button v-if="this.sort === 0" type="primary" size="small" @click="registerResult">登记</el-button>
                        <el-button v-if="this.sort === 1" type="primary" size="small" @click="checkResult">审核</el-button>
                    </el-col>
                </el-row>
            </el-form>
            <!-- 添加登记弹框 -->
            <expriment-result :show.sync="showRegister"></expriment-result>
            <!-- 添加审核弹框 -->
            <expriment-result-check :show.sync="showCheck"></expriment-result-check>
            <el-table :data="tableData" border stripe>
                <el-table-column type="index" label="序号" align="center" :resizable="false" width="50"></el-table-column>
                <el-table-column prop="" label="计量器具状态" :resizable="false" min-width="110"></el-table-column>
                <el-table-column prop="" label="任务类型" :resizable="false" min-width="90"></el-table-column>
                <el-table-column prop="" label="任务单号" :resizable="false" min-width="100"></el-table-column>
                <el-table-column prop="" label="出厂编号" :resizable="false" min-width="100"></el-table-column>
                <el-table-column prop="" label="物料号" :resizable="false" min-width="80"></el-table-column>
                <el-table-column prop="" label="规格" :resizable="false" min-width="60"></el-table-column>
                <el-table-column prop="" label="器具名称" :resizable="false" min-width="80"></el-table-column>
                <el-table-column prop="" label="统一编号" :resizable="false" min-width="90"></el-table-column>
                <el-table-column prop="" label="样品分码" :resizable="false" min-width="90"></el-table-column>
                <el-table-column prop="" label="附件" :resizable="false" min-width="100"></el-table-column>
                <el-table-column prop="" label="检测结论" :resizable="false" min-width="100"></el-table-column>
                <el-table-column prop="" label="检测附件" :resizable="false" min-width="100"></el-table-column>
            </el-table>
            <div slot="footer" class="dialog-footer">
                <el-button v-if="this.sort === 2" type="primary" @click="dialogVisible = false">关 闭</el-button>
                <div v-else>
                    <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
                    <el-button @click="dialogVisible = false">取 消</el-button>
                </div>
                
            </div>
        </el-dialog>
    </div>
</template>

<script>
    import ExprimentResult from 'dialog/lab-report-manage/inspect-lab-report/expriment-result';
    import ExprimentResultCheck from 'dialog/lab-report-manage/inspect-lab-report/expriment-result-check';
    export default {
        components: {
            'expriment-result': ExprimentResult,
            'expriment-result-check': ExprimentResultCheck
        },
        data() {
            return {
                dialogTitle: '新报验实验结果登记',
                dialogVisible: this.show,
                form: {
                    sort: '',
                    name: ''
                },
                tableData: [],
                options: {},
                optionVal: '',
                showRegister: false,
                showCheck: false
            }
        },
        props: {
            show: {
                type: Boolean,
                default: false
            },
            // 判断弹框类型是新增或修改或详情
            sort: {
                type: Number,
                default: 0
            }
        },
        watch: {
            show() {
                this.dialogVisible = this.show;
                // 动态显示dialog的title
                this.sort === 0 ? this.dialogTitle='新报验实验结果登记' : this.sort === 1 ? this.dialogTitle='新报验实验结果审核' : this.dialogTitle='查看';
            }
        },
        methods: {
            handleClose() {
                this.dialogVisible = false;
            },
            // 弹框： 登记实验结论
            registerResult(){
                this.showRegister = true;
            },
            // 弹框： 审核实验结论
            checkResult() {
                this.showCheck = true;
            }
        }
    }
</script>